﻿using System;
using Aquarinum.Base.Infrastructure.Ioc;

namespace Aquarinum.Base.Infrastructure.WebSocket.Extensions
{
    /// <summary>
    ///     自定义DI 注册策略
    /// </summary>
    public class ServiceRegisterStrategy
    {
        public ServiceRegisterStrategy(Type abstractType, Type impType, EnumLifetimeScope lifetimeScope)
        {
            AbstractType = abstractType;
            ImpType = impType;
            LifetimeScope = lifetimeScope;
        }

        public ServiceRegisterStrategy(Type abstractType, Type impType)
        {
            AbstractType = abstractType;
            ImpType = impType;
            LifetimeScope = EnumLifetimeScope.InstancePerDependency;
        }

        public ServiceRegisterStrategy(Type impType)
        {
            AbstractType = impType;
            ImpType = impType;
            LifetimeScope = EnumLifetimeScope.InstancePerDependency;
        }

        /// <summary>
        ///     抽象类型
        /// </summary>
        public Type AbstractType { get; set; }

        /// <summary>
        ///     反转类型
        /// </summary>
        public Type ImpType { get; set; }

        /// <summary>
        ///     生命周期
        /// </summary>
        public EnumLifetimeScope LifetimeScope { get; set; }
    }
}